using System;
using System.IO;

using ObjectRelationalMapping;

namespace ExternalTool
{
    class Program
    {
        static void Main ( string[] args )
        {
            string projectDirectory = string.Empty;
            if ( args.Length > 0 )
            {
                projectDirectory = args[ 0 ];
            }
            else
            {
                projectDirectory =
                    Directory.GetCurrentDirectory ();
                projectDirectory =
                    projectDirectory.Substring (
                        0, projectDirectory.IndexOf ( @"bin" ) );
            }

            try
            {
                Generator.Generate ( projectDirectory );
            }
            catch ( Exception e )
            {
                Console.WriteLine ( "\n{0}", e.Message );
            }
        }
    }
}
